<template>
  <a-row :gutter="5">
    <a-card style="position: relative">
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="6" :sm="8">
              <a-form-item label="定性">
                <a-input placeholder="请输入" v-model="queryParam.dingxing"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="责任界定">
                <a-input placeholder="请输入" v-model="queryParam.zrjd"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
              <a-form-item label="所属单位">
                <j-select-depart v-model="queryParam.comId" :trigger-change="true" customReturnField="id"
                                 :multi="true"></j-select-depart>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
                <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                  <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                  <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">清除条件</a-button>
                </span>
            </a-col>
          </a-row>
        </a-form>
      </div>

      <!-- 操作按钮区域 -->
      <div class="table-operator">
        <a-button type="primary" style='background-color: #FFA500;border: 0' @click="onDrafView">底稿列表</a-button>
        <a-button type="primary" style='background-color: #1A91B3;border: 0' @click="onDownLoad">模板下载</a-button>
        <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
                  :action="url.importExcelUrl" @change="handleImportExcel"
                  accept=".docx, .doc, .xlsx, .xls, .pdf, .jpeg, .png">
          <a-button type="primary" style='background-color: #1EA489;border: 0' v-has="'question:export'">Excel导入
          </a-button>
        </a-upload>
      </div>

      <!-- table区域-begin -->
      <div>
        <a-table
          ref="table"
          size="middle"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          @change="handleTableChange">
          <span slot="wtms" slot-scope="text">
              <j-ellipsis :value="text" :length="10"/>
            </span>
          <span slot="dxyj" slot-scope="text">
              <j-ellipsis :value="text" :length="10"/>
            </span>
          <span slot="zrjd" slot-scope="text">
              <j-ellipsis :value="text" :length="10"/>
          </span>
          <span slot="zgjy" slot-scope="text">
              <j-ellipsis :value="text" :length="10"/>
            </span>
          <span slot="actionName">
              <a-button size="small" @click="handleAdd('问题台账-新增')" v-has="'question:add'" type="primary"
                        icon="plus">新增</a-button>
            </span>
          <span slot="action" slot-scope="text, record">
            <span v-has="'question:detail'">
              <a @click="handleCheck(record,'问题台账-查看')">查看</a>
              <a-divider type="vertical"/>
            </span>
            <a @click="handleEdit(record,'问题台账-编辑')" v-has="'question:edit'">编辑</a>
          </span>
        </a-table>
      </div>
      <!-- table区域-end -->
      <CheckAndEditModel ref="modalForm" @ok="modalFormOk"></CheckAndEditModel>
      <DrafView ref="drafView" @ok="modalFormOk"></DrafView>
    </a-card>
  </a-row>
</template>
<script>
  // 表头
  import LeftTree from '../../components/LeftTree'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import CheckAndEditModel from './CheckAndEditModel'
  import DrafView from './DrafView'
  import JEditor from '@/components/jeecg/JEditor'
  import columns from './indexColumns'

  export default {
    name: '审计案例管理',
    mixins: [JeecgListMixin],
    components: {
      LeftTree,
      CheckAndEditModel,
      JEditor,
      DrafView
    },
    data() {
      return {
        queryParam: {},
        // 表头
        columns: columns(this),
        url: {
          list: '/sjcg/sjWorkZtfaEveDigaoStandBook/getAccountList',
          delete: '/sjal/sjWorkZtfaCase/delete',
          importExcelUrl: `${window._CONFIG['domianURL']}/sjal/sjWorkZtfaCase/importExcel`
        },
      }
    },
    methods: {
      onDownLoad() {
        this.$message.success('正在下载，请稍等！')
        let url = `${window._CONFIG['domianURL']}/sys/common/static/xls-template/sjal.xlsx`
        window.open(url, '_blank')
      },
      onDrafView() {
        this.$refs.drafView.visible = true
      }
    },
    created() {
    },
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>
<style lang="less" scoped>

  .ant-row {
    height: 100%;

    .ant-col {
      height: 100%;

      .ant-card {
        height: 100%;

        /deep/ .ant-card-body {
          padding: 15px;
        }
      }
    }
  }

</style>